﻿using System;
using System.Collections.Generic;
using System.Text;
using SQLite;

namespace FileSystem.Models {
    /// <summary>
    /// 目录项
    /// </summary>
    public class DirItem {
        /// <summary>
        /// 目录项ID
        /// </summary>
        [PrimaryKey]
        [AutoIncrement]
        public int Id { get; set; }

        /// <summary>
        /// 目录项名称
        /// </summary>
        public string DirItemName { get; set; }

        /// <summary>
        /// 标识符
        /// </summary>
        public string Identifier { get; set; }

        /// <summary>
        /// 目录项类型
        /// </summary>
        public string DirItemType { get; set; }

        /// <summary>
        /// 位置
        /// </summary>
        public string Location { get; set; }

        /// <summary>
        /// 大小
        /// </summary>
        public int Size { get; set; }

        /// <summary>
        /// 当目录项为文件夹时使用 格式: FolderContent="DirItemName,DirItemName,DirItemName,DirItemName" 示例:FolderContent="子文件夹1的名字,子文件夹2的名字,子文件1的名字,子文件2的名字" 
        /// </summary>
        public string FolderContent { get; set; }

        /// <summary>
        /// 是否是根目录项
        /// </summary>
        public bool IsRootDirItem { get; set; }

        /// <summary>
        /// 物理块地址
        /// </summary>
        public int PhysicalBlockAddress { get; set; }

        /// <summary>
        /// 文件夹 
        /// </summary>
        public static readonly DirItem Folder =
            new DirItem {DirItemType = FolderConst};

        /// <summary>
        /// 纸张
        /// </summary>
        public static readonly DirItem Paper =
            new DirItem {DirItemType = PaperConst};

        /// <summary>
        /// 目录项数组
        /// </summary>
        public static readonly List<DirItem> DirItems =
            new List<DirItem> {Folder, Paper};

        public const string FolderConst = "文件夹";
        public const string PaperConst = "纸    张";
    }

    public static class DirItemConst {
        public enum Property {
            DirItemName,
            Identifier,
            DirItemType,
            Location,
            Size,
            FolderContent,
            IsRootDirItem,
            PhysicalBlockAddress
        }

        public enum Type {
            Folder,
            Paper
        }
    }
}